package com.jhws.common.base.controller;

import com.jhws.util.LogHelper;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;

/**
 * Created by Administrator on 2017/4/25.
 */
@Controller
@RequestMapping("/open")
public class OpenCtrl {

    @RequestMapping("webApiError.x")
    public ModelAndView webApiError(HttpServletRequest request,int httpStatus, String content, String errorInfo){
        ModelAndView view = new ModelAndView();

        Throwable t = (Throwable) request.getAttribute("javax.servlet.error.exception");
        if(t != null) {
            t.printStackTrace();
        }

        view.addObject("httpStatus", httpStatus);
        view.addObject("content", content);
        view.addObject("errorInfo", errorInfo);
        view.setViewName("error/web-api-error");

        return view;
    }
}
